import {createStore, applyMiddleware} from 'redux';
// redux 持久化插件
import {persistStore, persistReducer} from 'redux-persist';
import storage from 'redux-persist/lib/storage';

import thunk from 'redux-thunk';
import reducer from './reducer';

const storageConfig = {
  key: 'root',
  storage: storage,
  // blacklist: ['name'] // reducer里无需持久化的数据,
}

const myPersistReducer = persistReducer(storageConfig, reducer); //persist包装reducer
const store = createStore(
  myPersistReducer,
  applyMiddleware(thunk)
);
export const persistor = persistStore(store);

export default store;

